package com.qf.j2105.service.impl;

import com.qf.j2105.mapper.AddresDetaiedMapper;
import com.qf.j2105.mapper.GoodMapper;
import com.qf.j2105.po.AddresDetaied;
import com.qf.j2105.po.Good;
import com.qf.j2105.service.AddreDetaiedService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AddreDetaiedServiceImpl implements AddreDetaiedService {
    @Resource
    private AddresDetaiedMapper addresDetaiedMapper;
    @Resource
    private GoodMapper goodMapper;

    @Override
    public List<Good> selectByname(String name) {
        System.out.println("sname = " + name);
        //根据地址查名称
        AddresDetaied byname = addresDetaiedMapper.findByname(name);
        if (byname != null) {
            System.out.println("byname = " + byname);
            Integer id = byname.getId();
            System.out.println(id);
            List<Good> byid = goodMapper.findByid(id);

            return byid;
        }
        return null;
    }
}
